import request from '@/utils/request'

export function getFinancePage(pageNum, pageSize) {
  return request({
    url: '/finance/page',
    method: 'get',
    params: { pageNum, pageSize }
  })
}

export function searchFinance(pageNum, pageSize, searchObj) {
  return request({
    url: '/finance/search',
    method: 'post',
    params: { pageNum, pageSize },
    data: searchObj
  })
}

export function getFinanceRecordPage(reportId) {
  return request({
    url: '/finance_record/list',
    method: 'get',
    params: { reportId }
  })
}

export function addFinanceRecord(recordObj) {
  return request({
    url: '/finance_record/add',
    method: 'post',
    data: recordObj
  })
}

export function updateFinanceRecord(recordObj) {
  return request({
    url: '/finance_record/update',
    method: 'put',
    data: recordObj
  })
}

export function deleteFinanceRecord(id) {
  return request({
    url: '/finance_record/delete/' + id,
    method: 'delete'
  })
}

export function getFinanceRecordById(id) {
  return request({
    url: '/finance_record/' + id,
    method: 'get'
  })
}

export function downloadFinance(searchObj) {
  return request({
    url: '/finance/download',
    method: 'post',
    data: searchObj,
    responseType: 'blob'
  })
}
